/*
 * Copyright 2016. chenshufei
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package sz.szsmk.citizencard.retrofitrxjava;

import android.os.Build;

import com.squareup.okhttp.Headers;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import com.squareup.okhttp.ResponseBody;

import java.io.IOException;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;

import okhttp3.MultipartBody;
import okhttp3.logging.HttpLoggingInterceptor;
import okio.Buffer;
import okio.BufferedSource;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import rx.Observable;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.schedulers.Schedulers;
import sz.szsmk.citizencard.BuildConfig;
import sz.szsmk.citizencard.DaggerApplication;
import sz.szsmk.citizencard.log.L;
import sz.szsmk.citizencard.model.network.bean.UpdataVersionReq;
import sz.szsmk.citizencard.model.network.bean.request.*;
import sz.szsmk.citizencard.model.network.bean.response.AccountExistRes;
import sz.szsmk.citizencard.model.network.bean.response.AccumPointRes;
import sz.szsmk.citizencard.model.network.bean.response.AliUserInfoBean;
import sz.szsmk.citizencard.model.network.bean.response.AuthorBean;
import sz.szsmk.citizencard.model.network.bean.response.BaseBean;
import sz.szsmk.citizencard.model.network.bean.response.BindThirdRes;
import sz.szsmk.citizencard.model.network.bean.response.CakeBalanceBeanRes;
import sz.szsmk.citizencard.model.network.bean.response.CakeQRBeanRes;
import sz.szsmk.citizencard.model.network.bean.response.CalendarSignInRes;
import sz.szsmk.citizencard.model.network.bean.response.CardnoAuthorizationRes;
import sz.szsmk.citizencard.model.network.bean.response.CheckAcardRes;
import sz.szsmk.citizencard.model.network.bean.response.CheckSmsReponse;
import sz.szsmk.citizencard.model.network.bean.response.CheckThirdAppRes;
import sz.szsmk.citizencard.model.network.bean.response.CheckThirdAppUserRes;
import sz.szsmk.citizencard.model.network.bean.response.CheckUserByMobileRes;
import sz.szsmk.citizencard.model.network.bean.response.CheckUserEcityRes;
import sz.szsmk.citizencard.model.network.bean.response.CheckVirCakeBeanRes;
import sz.szsmk.citizencard.model.network.bean.response.CollecQueryRes;
import sz.szsmk.citizencard.model.network.bean.response.FirstSearchUserLevelRes;
import sz.szsmk.citizencard.model.network.bean.response.GestureValidBean;
import sz.szsmk.citizencard.model.network.bean.response.GetOrderOpenidRes;
import sz.szsmk.citizencard.model.network.bean.response.GetResourceReq;
import sz.szsmk.citizencard.model.network.bean.response.GetTokenRes;
import sz.szsmk.citizencard.model.network.bean.response.GetUrlRes;
import sz.szsmk.citizencard.model.network.bean.response.GetUserBindCardRes;
import sz.szsmk.citizencard.model.network.bean.response.HomeAllfunResponse;
import sz.szsmk.citizencard.model.network.bean.response.HomeHeadFuncResponse;
import sz.szsmk.citizencard.model.network.bean.response.HomeWeathRes;
import sz.szsmk.citizencard.model.network.bean.response.HomeWhxfRes;
import sz.szsmk.citizencard.model.network.bean.response.HotRes;
import sz.szsmk.citizencard.model.network.bean.response.IUserInfo;
import sz.szsmk.citizencard.model.network.bean.response.IbaseBean;
import sz.szsmk.citizencard.model.network.bean.response.ImgCodeRes;
import sz.szsmk.citizencard.model.network.bean.response.ModifyNickNameReq;
import sz.szsmk.citizencard.model.network.bean.response.NoticeDetailRes;
import sz.szsmk.citizencard.model.network.bean.response.NoticeListRes;
import sz.szsmk.citizencard.model.network.bean.response.NoticeMainres;
import sz.szsmk.citizencard.model.network.bean.response.OauthTokenRes;
import sz.szsmk.citizencard.model.network.bean.response.OneWordRes;
import sz.szsmk.citizencard.model.network.bean.response.PowerCheckOrderRes;
import sz.szsmk.citizencard.model.network.bean.response.PowerGetMac2Res;
import sz.szsmk.citizencard.model.network.bean.response.PowerRechargeRes;
import sz.szsmk.citizencard.model.network.bean.response.PrepayResponse;
import sz.szsmk.citizencard.model.network.bean.response.ProtocolsRes;
import sz.szsmk.citizencard.model.network.bean.response.ProtocolsShowRes;
import sz.szsmk.citizencard.model.network.bean.response.QRCodeBean;
import sz.szsmk.citizencard.model.network.bean.response.QuerLeisureCardsInfoRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryAdressResponse;
import sz.szsmk.citizencard.model.network.bean.response.QueryAllCardFuncRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryAllFunctionNewRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryBusLineNearbyRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryBusRouteRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryCardAccInfoRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryCitizenCardRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryDonationRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryInterductionAreaRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryInvoiceOpensRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryMainAdRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryMainPageFunctionRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryMetroExitInfoRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryNearMetroStandbyRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryNearStandbyRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryNgFinanceRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryOrderCountRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryPageResourceRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryStandLinesRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryUserBindCardRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryUserCardRes;
import sz.szsmk.citizencard.model.network.bean.response.QueryUserCardResponse;
import sz.szsmk.citizencard.model.network.bean.response.QuestionRes;
import sz.szsmk.citizencard.model.network.bean.response.RecommendRes;
import sz.szsmk.citizencard.model.network.bean.response.SearchViewResponse;
import sz.szsmk.citizencard.model.network.bean.response.SeleciUserAuthRes;
import sz.szsmk.citizencard.model.network.bean.response.ShopListRes;
import sz.szsmk.citizencard.model.network.bean.response.SignInRes;
import sz.szsmk.citizencard.model.network.bean.response.SimpleRes;
import sz.szsmk.citizencard.model.network.bean.response.SttAuthResponse;
import sz.szsmk.citizencard.model.network.bean.response.SuggestMsgRes;
import sz.szsmk.citizencard.model.network.bean.response.TagConfigRes;
import sz.szsmk.citizencard.model.network.bean.response.ThirdAppLoginRes;
import sz.szsmk.citizencard.model.network.bean.response.TransLogRes;
import sz.szsmk.citizencard.model.network.bean.response.UpdataVersionRes;
import sz.szsmk.citizencard.model.network.bean.response.UserBean;
import sz.szsmk.citizencard.model.network.bean.response.UserCardFavResponse;
import sz.szsmk.citizencard.model.network.bean.response.UserInfoRes;
import sz.szsmk.citizencard.model.network.bean.response.ValidCardAuthorizationRes;
import sz.szsmk.citizencard.model.network.bean.response.VerifyBindNgUserRes;
import sz.szsmk.citizencard.model.network.bean.response.WeathDetailRes;
import sz.szsmk.citizencard.model.network.bean.response.WebsiteInfoRes;
import sz.szsmk.citizencard.model.network.bean.response.YXCRes;
import sz.szsmk.citizencard.model.network.bean.response.YzanResponse;
import sz.szsmk.citizencard.model.network.clarkbean.response.AreaInfoResponse;
import sz.szsmk.citizencard.model.network.dzbean.req.BaseRequest;
import sz.szsmk.citizencard.model.network.dzbean.req.CommonRequest;
import sz.szsmk.citizencard.model.network.dzbean.req.DzsmkAgreementReq;
import sz.szsmk.citizencard.model.network.dzbean.req.GetOpenIdReq;
import sz.szsmk.citizencard.model.network.dzbean.req.PreAuthThiedReq;
import sz.szsmk.citizencard.model.network.dzbean.req.PreAuthThirdRes;
import sz.szsmk.citizencard.model.network.dzbean.req.QueryDzsmkAgreementReq;
import sz.szsmk.citizencard.model.network.dzbean.res.CheckIsRealName2Res;
import sz.szsmk.citizencard.model.network.dzbean.res.CheckIsRealNameRes;
import sz.szsmk.citizencard.model.network.dzbean.res.GetOpenIdRes;
import sz.szsmk.citizencard.model.network.dzbean.res.QueryDzsmkAgreeMentRes;
import sz.szsmk.citizencard.mvp.presenter.APPHomePresenter;
import sz.szsmk.citizencard.retrofitrxjava.net.persistentcookiejar.PersistentCookieJar;
import sz.szsmk.citizencard.model.network.bean.response.CouponListBean;
import sz.szsmk.citizencard.retrofitrxjava.newversion.HttpDateSource;
import sz.szsmk.citizencard.util.Constant;
import sz.szsmk.citizencard.util.CookieHandler;


/**
 * 智慧苏州APP网络层资源类
 */
public class NetworkDateSources {
    private final HttpApi mHttpApi;
    private static PersistentCookieJar persistentCookieJar;
    private static final Charset UTF8 = Charset.forName("UTF-8");
    private static final NetworkDateSources sNetworkDateSource = new NetworkDateSources();



    static class Creator {

        public static HttpApi newHttpApi() {

            //这是2.5的 okhttp
            OkHttpClient client = new OkHttpClient();
            client.setConnectTimeout(20, TimeUnit.SECONDS);
            client.setReadTimeout(1000 * 120, TimeUnit.MILLISECONDS);
            client.setWriteTimeout(1000 * 120, TimeUnit.MILLISECONDS);
            CookieManager cookieManager = new CookieManager();
            cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
            client.setCookieHandler(cookieManager);

            HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
            logging.setLevel(HttpLoggingInterceptor.Level.BODY);


            client.interceptors().add(new Interceptor() {
                @Override
                public Response intercept(Chain chain) throws IOException {
                    Request request = chain.request();
                    Request newRequest = request.newBuilder()
                            //.addHeader("accept", "application/json")
                            .addHeader("Content-Language", "zh-CN")
                            .addHeader("Accept-Language", "zh-CN")
                            .addHeader("Platform", "android")
                            //版本号
                            .addHeader("Version", BuildConfig.VERSION_NAME)
                            //时区   值:Asia/Shanghai
                            .addHeader("TimeZone", TimeZone.getDefault().getID())
                            //语言
                            .addHeader("Language",  DaggerApplication.getIns().getResources().getConfiguration().locale.getLanguage())
                            //型号
                            .addHeader("Model",  Build.MODEL)
                            //SDK版本
                            .addHeader("SDKVersion", Build.VERSION.RELEASE)
                            .build();
                    Headers headers = request.headers();
//                    L.e("request url:" + request.toString());
//                    L.e("request headers:" + headers);
                    Map<String, List<String>> headerListMap = headers.toMultimap();
                    for (Map.Entry<String, List<String>> entry : headerListMap.entrySet()) {
                        List<String> values = entry.getValue();
                        StringBuffer sb = new StringBuffer();
                        for (String value : values) {
                            sb.append(value).append(" ");
                        }
                    }


                    Response proceed = chain.proceed(newRequest);
                    ResponseBody responseBody = proceed.body();
                    BufferedSource source = responseBody.source();
                    source.request(Long.MAX_VALUE); // Buffer the entire body.
                    Buffer buffer = source.buffer();

                    Charset charset = UTF8;
                    MediaType contentType = responseBody.contentType();
                    if (contentType != null) {
                        charset = contentType.charset(UTF8);
                    }

                    if (responseBody.contentLength() != 0) {
                        L.e(Constant.TAG, request.toString() + "APP-------响应内容:" + buffer.clone().readString(charset));
                    }
                    String host = request.url().getHost();
                    CookieHandler.processResponseCookie(proceed, host);
                    return proceed;
                }
            });

            Retrofit retrofit = new Retrofit.Builder()
                    .baseUrl(Constant.BASE_URL)
                    .addConverterFactory(GsonConverterFactory.create())
                    .addCallAdapterFactory(RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io()))
                    .client(HttpDateSource.INSTANCE.getOkHttpClient())
                    .build();
            return retrofit.create(HttpApi.class);
        }
    }


    private NetworkDateSources() {
        mHttpApi = Creator.newHttpApi();
    }

    public static NetworkDateSources getInstance() {
        return sNetworkDateSource;
    }

    public HttpApi getHttpApi() {
        return mHttpApi;
    }

    // 不强制 T extends BaseBean 了
    private <T> Subscription doSubscription(Observable<T> observable, Action1<T> action1, Action1<Throwable> onError) {
        if (null != onError) {
            return observable.observeOn(AndroidSchedulers.mainThread()) //处理的结果 给 订阅者返回是在主线程的
                    .subscribeOn(Schedulers.io()) //被观察者observable是在io线程里处理的，
                    .subscribe(action1, onError);
        } else {
            return observable.observeOn(AndroidSchedulers.mainThread())
                    .subscribeOn(Schedulers.io())
                    .subscribe(action1);
        }
    }

    //获取验证码
    public Subscription getCode(String channel_id, String device_id, String phone, String type, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getCode(channel_id, device_id, phone, type), action1, onError);
    }


    public Subscription register(RegisterRequest transMoneyRequest, Action1<UserBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.register(transMoneyRequest), action1, onError);
    }

    public Subscription getSms(GetCodeRequest transMoneyRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.getSms(transMoneyRequest), action1, onError);
    }

    public Subscription updateUserPhone(GetCodeRequest transMoneyRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.updateUserPhone(transMoneyRequest), action1, onError);
    }

    public Subscription checkSms(CheckCodeRequest transMoneyRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.checkSms(transMoneyRequest), action1, onError);
    }

    public Subscription checkUserByMobile(CheckUserRequest checkUserRequest, Action1<CheckUserByMobileRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.checkUserByMobile(checkUserRequest), action1, onError);
    }

    public Subscription checkThirdAppMobile(CheckThirdAppReq checkThirdAppReq, Action1<CheckThirdAppRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.checkThirdAppMobile(checkThirdAppReq), action1, onError);
    }

    public Subscription modifyCardNickName(ModifyNickNameReq checkThirdAppReq, Action1<BaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.modifyCardNickName(checkThirdAppReq), action1, onError);
    }

    public Subscription queryBusLineNearby(QueryBusLineNearbyReq checkThirdAppReq, Action1<QueryBusLineNearbyRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.queryBusLineNearby(checkThirdAppReq), action1, onError);
    }

    public Subscription queryMetroExitInfo(QueryMetroExitInfoReq queryMetroExitInfoReq, Action1<QueryMetroExitInfoRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.queryMetroExitInfo(queryMetroExitInfoReq), action1, onError);
    }

    public Subscription queryCollectedBusLine(QueryCollectedBusLineReq checkThirdAppReq, Action1<QueryBusLineNearbyRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.queryCollectedBusLine(checkThirdAppReq), action1, onError);
    }

    public Subscription queryLineByLineName(QueryLineByLineNameReq checkThirdAppReq, Action1<QueryBusLineNearbyRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.queryLineByLineName(checkThirdAppReq), action1, onError);
    }

    public Subscription queryBusRoute(QueryBusRouteReq queryBusRouteReq, Action1<QueryBusRouteRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.queryBusRoute(queryBusRouteReq), action1, onError);
    }

    public Subscription collectedBusLine(CollectedBusLineReq queryBusRouteReq, Action1<BaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.collectedBusLine(queryBusRouteReq), action1, onError);
    }

    public Subscription cancelCollectedBusLine(CollectedBusLineReq queryBusRouteReq, Action1<BaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.cancelCollectedBusLine(queryBusRouteReq), action1, onError);
    }

    public Subscription queryStandLines(QueryStandLinesReq queryBusRouteReq, Action1<QueryStandLinesRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.queryStandLines(queryBusRouteReq), action1, onError);
    }

    public Subscription quryCommonwealInfor(AccessTokenRequest accessTokenRequest, Action1<QueryDonationRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.quryCommonwealInfor(accessTokenRequest), action1, onError);
    }

    public Subscription cardnoAuthorization(CardnoAuthorizationReq accessTokenRequest, Action1<CardnoAuthorizationRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.cardnoAuthorization(accessTokenRequest), action1, onError);
    }

    public Subscription unBindThirdAppUser(UnbindReq accessTokenRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.unBindThirdAppUser(accessTokenRequest), action1, onError);
    }

    public Subscription quryAllCards(QueryAllCardsReq accessTokenRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.quryAllCards(accessTokenRequest), action1, onError);
    }

    public Subscription quryLeisureCards(QueryAllCardsReq accessTokenRequest, Action1<QuerLeisureCardsInfoRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.quryLeisureCards(accessTokenRequest), action1, onError);
    }

    public Subscription checkUserEcity(AccessTokenRequest accessTokenRequest, Action1<CheckUserEcityRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.checkUserEcity(accessTokenRequest), action1, onError);
    }

    public Subscription qurACard(QueryAllCardsReq accessTokenRequest, Action1<CheckAcardRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.qurACard(accessTokenRequest), action1, onError);
    }
 public Subscription queryInterductionArea(GetResourceReq accessTokenRequest, Action1<QueryInterductionAreaRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.queryInterductionArea(accessTokenRequest), action1, onError);
    }

    public Subscription queryMainPageFunction(AccessTokenRequest accessTokenRequest, Action1<QueryMainPageFunctionRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.queryMainPageFunction(accessTokenRequest), action1, onError);
    }

    public Subscription queryCitizenCard(QueryCitizenCardReq accessTokenRequest, Action1<QueryCitizenCardRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.queryCitizenCard(accessTokenRequest), action1, onError);
    }


    public Subscription simple(SimpleReq accessTokenRequest, Action1<SimpleRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.simple(accessTokenRequest), action1, onError);
    }

    public Subscription setUserPad(SetPsdRequest setPsdRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.setUserPad(setPsdRequest), action1, onError);
    }


    public Subscription queryOrderCount(AccessTokenRequest accessTokenRequest, Action1<QueryOrderCountRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.queryOrderCount(accessTokenRequest), action1, onError);
    }

    public Subscription faceRecognition(FaceRecognitionReq faceRecognitionReq, Action1<BaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.faceRecognition(faceRecognitionReq), action1, onError);
    }

    public Subscription selectUserAuth(AccessTokenRequest accessTokenRequest, Action1<SeleciUserAuthRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.selectUserAuth(accessTokenRequest), action1, onError);
    }

    public Subscription authUser(AuthUserReq accessTokenRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.authUser(accessTokenRequest), action1, onError);
    }

    public Subscription dzsmkAgreement(DzsmkAgreementReq commonRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.dzsmkAgreement(commonRequest), action1, onError);
    }


    public Subscription checkThirdAppUser(CheckThirdAppUserReq checkThirdAppUserReq, Action1<CheckThirdAppUserRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.checkThirdAppUser(checkThirdAppUserReq), action1, onError);
    }

    public Subscription thirdAppLogin(ThirdAppLoginReq thirdAppLoginReq, Action1<ThirdAppLoginRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.thirdAppLogin(thirdAppLoginReq), action1, onError);
    }

    public Subscription getBindThirdApp(BindThirdReq bindThirdReq, Action1<BindThirdRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getBindThirdApp(bindThirdReq), action1, onError);
    }

    public Subscription oauthToken(IBaseRequest iBaseRequest, Action1<OauthTokenRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.oauthToken(iBaseRequest), action1, onError);
    }

    public Subscription termAllVerify(PowerCheckOrderReq powerCheckOrderReq, Action1<PowerCheckOrderRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.termAllVerify(powerCheckOrderReq), action1, onError);
    }

    public Subscription sttAuth(SttAuthRequest sttAuthRequest, Action1<SttAuthResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.sttAuth(sttAuthRequest), action1, onError);
    }

    public Subscription bluetoothOrder(PowerRechargeReq powerRechargeReq, Action1<PowerRechargeRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.bluetoothOrder(powerRechargeReq), action1, onError);
    }

    public Subscription termTopupMac2(PowerGetMac2Req powerRechargeReq, Action1<PowerGetMac2Res> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.termTopupMac2(powerRechargeReq), action1, onError);
    }

    public Subscription queryNearStandby(QueryNearStandbyReq queryNearStandbyReq, Action1<QueryNearStandbyRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryNearStandby(queryNearStandbyReq), action1, onError);
    }
    public Subscription queryNearMetroStandby(QueryNearStandbyReq queryNearStandbyReq, Action1<QueryNearMetroStandbyRes> action1, Action1<Throwable> onError){
        return  doSubscription(mHttpApi.queryNearMetroStandby(queryNearStandbyReq),action1,onError);
    }

    public Subscription collectStand(CollectStandReq collectStandReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.collectStand(collectStandReq), action1, onError);
    }

    public Subscription cancelCollectStand(CollectStandReq collectStandReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.cancelCollectStand(collectStandReq), action1, onError);
    }

    public Subscription queryCollectedStand(QueryCollectedStandreq queryNearStandbyReq, Action1<QueryNearStandbyRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryCollectedStand(queryNearStandbyReq), action1, onError);
    }

    public Subscription queryBusStandByKey(QueryBusStandBykeyReq queryBusStandBykeyReq, Action1<QueryNearStandbyRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryBusStandByKey(queryBusStandBykeyReq), action1, onError);
    }

    public Subscription login(LoginRequest loginRequest, Action1<UserBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.login(loginRequest), action1, onError);
    }

    public Subscription author(AuthorRequest authorRequest, Action1<AuthorBean> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.author(authorRequest), action1, onError);
    }

    public Subscription getUserInfoZhsz(IBaseRequest loginRequest, Action1<IUserInfo> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.getUserInfoZhsz(loginRequest), action1, onError);
    }

    public Subscription getAppVersion(UpdataVersionReq loginRequest, Action1<UpdataVersionRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.getAppVersion(loginRequest), action1, onError);
    }


    public Subscription getToken(GetTokenReq getTokenReq, Action1<GetTokenRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.getToken(getTokenReq), action1, onError);
    }

    public Subscription queryAllFunc(IBaseRequest baseRequest, Action1<HomeAllfunResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryAllFunc(baseRequest), action1, onError);
    }

    public Subscription queryHeadFunc(IBaseRequest baseRequest, Action1<HomeHeadFuncResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryHeadFunc(baseRequest), action1, onError);
    }

    public Subscription addPush(PushReq baseRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.addPush(baseRequest), action1, onError);
    }

    public Subscription userBindthirdApp(BindMyThirdReq bindMyThirdReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.userBindthirdApp(bindMyThirdReq), action1, onError);
    }

    public Subscription queryOneWordAd(IBaseRequest baseRequest, Action1<OneWordRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryOneWordAd(baseRequest), action1, onError);
    }
    public Subscription getIsChecked(APPHomePresenter.CheckRequest checkRequest, Action1<APPHomePresenter.CheckRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getIsChecked(checkRequest), action1, onError);
    }
    public Subscription recordUserFunction(RecordUserFunctionReq baseRequest, Action1<OneWordRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.recordUserFunction(baseRequest), action1, onError);
    }

    public Subscription queryPageResource(QueryPageResourceReq baseRequest, Action1<QueryPageResourceRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryPageResource(baseRequest), action1, onError);
    }

    public Subscription queryMainAd(IBaseRequest baseRequest, Action1<QueryMainAdRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryMainAd(baseRequest), action1, onError);
    }

    public Subscription queryPageAd(QueryPageAdRequest queryPageAdRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryPageAd(queryPageAdRequest), action1, onError);
    }

    public Subscription recordUserFunc(RecordUserFuncRequest recordUserFuncRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.recordUserFunc(recordUserFuncRequest), action1, onError);
    }

    public Subscription loginYzan(YzanRequest yzanRequest, Action1<YzanResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.loginYzan(yzanRequest), action1, onError);
    }

    public Subscription unLoginYzan(Action1<YzanResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.unLoginYzan(), action1, onError);
    }


    public Subscription prepayWebsiteList(PrepayWebRequest prepayWebRequest, Action1<PrepayResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.prepayWebsiteList(prepayWebRequest), action1, onError);
    }

    public Subscription websiteList(ServiceNetReq prepayWebRequest, Action1<PrepayResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.websiteList(prepayWebRequest), action1, onError);
    }

    public Subscription addCollection(CollecAddReq collecAddReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.addCollection(collecAddReq), action1, onError);
    }

    public Subscription deleteCollection(CollecAddReq collecAddReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.deleteCollection(collecAddReq), action1, onError);
    }

    public Subscription searchSpotAndHotelByKeyword(SearchViewRequest prepayWebRequest, Action1<SearchViewResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.searchSpotAndHotelByKeyword(prepayWebRequest), action1, onError);
    }

    public Subscription queryAdress(AccessTokenRequest prepayWebRequest, Action1<QueryAdressResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryAdress(prepayWebRequest), action1, onError);
    }

    public Subscription addAdress(AddAddressRequest prepayWebRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.addAdress(prepayWebRequest), action1, onError);
    }

    public Subscription delAdress(DelAdressRequest prepayWebRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.delAdress(prepayWebRequest), action1, onError);
    }

    public Subscription updataAdress(UpdataAdressRequest prepayWebRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.updataAdress(prepayWebRequest), action1, onError);
    }

    public Subscription bindCard(BindCardRequest bindCardRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.bindCard(bindCardRequest), action1, onError);
    }

    public Subscription unBindCard(UnbindCardReq unbindCardReq, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.unBindCard(unbindCardReq), action1, onError);
    }

    public Subscription queryUserCardFav(AccessTokenRequest accessTokenRequest, Action1<UserCardFavResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryUserCardFav(accessTokenRequest), action1, onError);
    }

    public Subscription queryQA(QuestionReq questionReq, Action1<QuestionRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryQA(questionReq), action1, onError);
    }

    public Subscription queryUserCard(QueryUserCardRequest queryUserCardRequest, Action1<QueryUserCardResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryUserCard(queryUserCardRequest), action1, onError);
    }

    public Subscription verifySpecialAccount(SpecialAuthReq queryUserCardRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.verifySpecialAccount(queryUserCardRequest), action1, onError);
    }

    public Subscription getUserBindCard(AccessTokenRequest queryUserCardRequest, Action1<GetUserBindCardRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getUserBindCard(queryUserCardRequest), action1, onError);
    }

    public Subscription addUserCardFav(AddUserCardFavReq addUserCardFavReq, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.addUserCardFav(addUserCardFavReq), action1, onError);
    }

    public Subscription websiteInfo(WebsiteInfoReq addUserCardFavReq, Action1<WebsiteInfoRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.websiteInfo(addUserCardFavReq), action1, onError);
    }

    public Subscription shopList(ShopListReq shopListReq, Action1<ShopListRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.shopList(shopListReq), action1, onError);
    }

    public Subscription shopSearch(ServiceSearchReq shopListReq, Action1<ShopListRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.shopSearch(shopListReq), action1, onError);
    }

    public Subscription queryCollect(CollecQueryReq accessTokenRequest, Action1<CollecQueryRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryCollect(accessTokenRequest), action1, onError);
    }

    public Subscription queryUserCollectCity(AccessTokenRequest accessTokenRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryUserCollectCity(accessTokenRequest), action1, onError);
    }

    public Subscription serviceSearch(ServiceSearchReq serviceSearchReq, Action1<PrepayResponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.serviceSearch(serviceSearchReq), action1, onError);
    }

    public Subscription submitUserFeedbackNoPic(SuggestReq suggestReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.submitUserFeedbackNoPic(suggestReq), action1, onError);
    }

    public Subscription queryUserFeedbackAnswer(SuggestMsgReq suggestMsgReq, Action1<SuggestMsgRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryUserFeedbackAnswer(suggestMsgReq), action1, onError);
    }

    public Subscription resetPassWord(ResetPsdReq resetPsdReq, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.resetPassWord(resetPsdReq), action1, onError);
    }

    public Subscription querybalance(QueryBalanceReq resetPsdReq, Action1<QueryBalanceRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.querybalance(resetPsdReq), action1, onError);
    }

    public Subscription queryBindCard(QueryUserBindCardReq queryUserBindCardReq, Action1<QueryUserBindCardRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryBindCard(queryUserBindCardReq), action1, onError);
    }

    public Subscription getACard(IsAcardReq queryUserBindCardReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getACard(queryUserBindCardReq), action1, onError);
    }

    public Subscription getUrl(AccessTokenRequest accessTokenRequest, Action1<GetUrlRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getUrl(accessTokenRequest), action1, onError);
    }

    public Subscription queryAllFunctionNew(IBaseRequest iBaseRequest, Action1<QueryAllFunctionNewRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryAllFunctionNew(iBaseRequest), action1, onError);
    }

    public Subscription changeUserFunc(ChangeUserFuncReq iBaseRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.changeUserFunc(iBaseRequest), action1, onError);
    }

    public Subscription recommend(RecommendReq iBaseRequest, Action1<RecommendRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.recommend(iBaseRequest), action1, onError);
    }

    public Subscription hot(HotReq iBaseRequest, Action1<HotRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.hot(iBaseRequest), action1, onError);
    }

    public Subscription quryAllCardsFunction(QueryCardFuncRequest iBaseRequest, Action1<QueryAllCardFuncRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.quryAllCardsFunction(iBaseRequest), action1, onError);
    }

    public Subscription queryTransRecords(TransLogReq resetPsdReq, Action1<TransLogRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryTransRecords(resetPsdReq), action1, onError);
    }

    public Subscription queryCardAcctInfo(TransLogReq resetPsdReq, Action1<QueryCardAccInfoRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryCardAcctInfo(resetPsdReq), action1, onError);
    }

    public Subscription getWeathFore(WeathDetailReq resetPsdReq, Action1<WeathDetailRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getWeathFore(resetPsdReq), action1, onError);
    }

    public Subscription getWeathGeneral(HomeWeathReq homeWeathReq, Action1<HomeWeathRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getWeathGeneral(homeWeathReq), action1, onError);
    }

    public Subscription getUserDetails(AccessTokenRequest accessTokenRequest, Action1<HomeWhxfRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getUserDetails(accessTokenRequest), action1, onError);
    }

    public Subscription changesIsRead(ChangeIsReadReq changeIsReadReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.changesIsRead(changeIsReadReq), action1, onError);
    }

    public Subscription changeAcctPassword(SpecialReq specialReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.changeAcctPassword(specialReq), action1, onError);
    }

    public Subscription getMainNotice(NoticeMainReq noticeMainReq, Action1<NoticeMainres> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getMainNotice(noticeMainReq), action1, onError);
    }

    public Subscription getNotcieList(NoticeListReq noticeListReq, Action1<NoticeListRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getNotcieList(noticeListReq), action1, onError);
    }

    public Subscription getNoticeDetail(NoticeDetailReq noticeDetailReq, Action1<NoticeDetailRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getNoticeDetail(noticeDetailReq), action1, onError);
    }

    public Subscription deleteMessageTypeByUser(NoticeDelItemReq noticeDelItemReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.deleteMessageTypeByUser(noticeDelItemReq), action1, onError);
    }

    public Subscription deleteMessageByDetailId(NoticeListDelReq noticeDelItemReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.deleteMessageByDetailId(noticeDelItemReq), action1, onError);
    }

    public Subscription getOrderOpenid(GetOrderOpenid noticeDetailReq, Action1<GetOrderOpenidRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getOrderOpenid(noticeDetailReq), action1, onError);
    }

    public Subscription queryDzsmkAgreement(QueryDzsmkAgreementReq noticeDetailReq, Action1<QueryDzsmkAgreeMentRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryDzsmkAgreement(noticeDetailReq), action1, onError);
    }

    public Subscription preAuthNew(PreAuthNewReq noticeDetailReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.preAuthNew(noticeDetailReq), action1, onError);
    }

    public Subscription getOpenId(GetOpenIdReq getOpenIdReq, Action1<GetOpenIdRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getOpenId(getOpenIdReq), action1, onError);
    }

    public Subscription modifyCardNickName(ModifyCardNickNameRequest modifyCardNickNameRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.modifyCardNickName(modifyCardNickNameRequest), action1, onError);
    }

    public Subscription firstSearchUserLevel(IBaseRequest firstSearchUserLevelRequest, Action1<FirstSearchUserLevelRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.firstSearchUserLevel(firstSearchUserLevelRequest), action1, onError);
    }

    public Subscription realNameCertificationL(RealNameCertificationLRequest realNameCertificationLRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.realNameCertificationL(realNameCertificationLRequest), action1, onError);
    }

    public Subscription gestureValid(IBaseRequest baseRequest, Action1<GestureValidBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.gestureValid(baseRequest), action1, onError);
    }

    public Subscription createGesturePassword(GestureRequest gestureRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.createGesturePassword(gestureRequest), action1, onError);
    }

    public Subscription validGesturePassword(GestureRequest gestureRequest, Action1<IbaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.validGesturePassword(gestureRequest), action1, onError);
    }

    public Subscription validCardAuthorization(IBaseRequest iBaseRequest, Action1<ValidCardAuthorizationRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.validCardAuthorization(iBaseRequest), action1, onError);
    }

    public Subscription getUserQRCode(QRCodeRequest iBaseRequest, Action1<QRCodeBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getUserQRCode(iBaseRequest), action1, onError);
    }

    public Subscription upLoadPic(UploadPic iBaseRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.upLoadPic(iBaseRequest), action1, onError);
    }

    public Subscription queryCouponCount(AccessTokenRequest accessTokenRequest, Action1<CouponListBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryCouponCount(accessTokenRequest), action1, onError);
    }

    //签到
    public Subscription signIn(SignInReq signInReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getsignIn(signInReq), action1, onError);
    }
    //获取积分
    public Subscription getUserScore(SignInReq signInReq, Action1<SignInRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getScore(signInReq), action1, onError);
    }
    //积分列表
    public Subscription getScoreList(AccumPointReq accumPointReq, Action1<AccumPointRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryUserCreditDtl(accumPointReq), action1, onError);
    }
    //签到
    public Subscription checkSign(SignInReq signInReq, Action1<SignInRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.checkSign(signInReq), action1, onError);
    }
    //获取签到日历
    public Subscription getCalendarSignIn(AccumPointReq accumPointReq, Action1<CalendarSignInRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getCalendarSignIn(accumPointReq), action1, onError);
    }
    //发送验证码
    public Subscription sendSmsCode(LoginRequest loginRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.sendSmsCode(loginRequest), action1, onError);
    }
    //检查验证码
    public Subscription checkCheckSmsCode(LoginRequest loginRequest, Action1<CheckSmsReponse> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.checkCheckSmsCode(loginRequest), action1, onError);
    }
    //注册 新接口
    public Subscription registerAndLogin(RegisterRequest registerRequest, Action1<UserBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.registerAndLogin(registerRequest), action1, onError);
    }

    //获取tag
    public Subscription getConfig(IBaseRequest iBaseRequest, Action1<TagConfigRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getConfig(iBaseRequest), action1, onError);
    }

    //判断是否是ng用户
    public Subscription verifyBindNgUser(VerifyBindNgUserReq verifyBindNgUserReq, Action1<VerifyBindNgUserRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.verifyBindNgUser(verifyBindNgUserReq), action1, onError);
    }
    //授权
    public Subscription toBindNgUser(VerifyBindNgUserReq verifyBindNgUserReq, Action1<VerifyBindNgUserRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.toBindNgUser(verifyBindNgUserReq), action1, onError);
    }
    //统计点击
    public Subscription userBehaviorBrowse(UserBehaviorBrowseReq userBehaviorBrowseReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.userBehaviorBrowse(userBehaviorBrowseReq), action1, onError);
    }

    // 我的获取用户卡信息列表
    public Subscription queryUserCardInfo(QueryUserCardRequest queryUserCardRequest, Action1<QueryUserCardRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryUserCardInfo(queryUserCardRequest), action1, onError);
    }

    //云闪充
    public Subscription ysc(YscReq yscReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.ysc(yscReq), action1, onError);
    }

    //活跃用户
    public Subscription userBehaviorActive(UserBehaviorReq queryUserCardRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.userBehaviorActive(queryUserCardRequest), action1, onError);
    }

    //判断是否开通 支付码
    public Subscription getIsOpenPayCode(CheckVirCakeBeanReq baseRequest, Action1<CheckVirCakeBeanRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getIsOpenPayCode(baseRequest), action1, onError);
    }

    //判断是否开通 支付码
    public Subscription getPayCode(CakeCardBeanReq baseRequest, Action1<CakeQRBeanRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getPayCode(baseRequest), action1, onError);
    }
    //获取余额
    public Subscription queryCakeBalance(CakeCardBeanReq cakeCardBeanReq, Action1<CakeBalanceBeanRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryCakeBalance(cakeCardBeanReq), action1, onError);
    }

    //用户认证 获取阿里串
    //活跃用户
    public Subscription oauthToken2(BaseRequest queryUserCardRequest, Action1<OauthTokenRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.oauthToken2(queryUserCardRequest), action1, onError);
    }

    //获取 支付宝 是否 实名认证
    public Subscription getAlipayUserInfo(BaseRequest queryUserCardRequest, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getAlipayUserInfo(queryUserCardRequest), action1, onError);
    }

    public Subscription checkIsRealName2(CommonRequest commonRequest, Action1<CheckIsRealName2Res> action1,Action1<Throwable> onError) {
        return doSubscription(mHttpApi.checkIsRealName2(commonRequest), action1, onError);
    }

    public Subscription getAreaInfo(IBaseRequest baseRequest, Action1<AreaInfoResponse> action1, Action1<Throwable> onError){
        return doSubscription(mHttpApi.getAreaInfo(baseRequest), action1, onError);
    }

    //获取优惠券信息

    public Subscription queryInvoiceOpens(QueryInvoiceOpensReq queryInvoiceOpensReq, Action1<QueryInvoiceOpensRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.queryInvoiceOpens(queryInvoiceOpensReq), action1, onError);
    }

    public Subscription queryNgFinance(QueryNgFinanceReq queryNgFinanceReq, Action1<QueryNgFinanceRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryNgFinance(queryNgFinanceReq), action1, onError);
    }

    //获取各种协议
    public Subscription getProtocols(ProtocolsRequest protocolsRequest, Action1<ProtocolsRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.queryProtocols(protocolsRequest), action1, onError);
    }

    //查看协议是否显示
    public Subscription showProtocols(ProtocolsShowReq protocolsShowReq, Action1<ProtocolsShowRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.isPopAgreement(protocolsShowReq), action1, onError);
    }

    //同意协议结果上传
    public Subscription addUserAppAgreementRecord(ProtocolsAgreeReq protocolsAgreeReq, Action1<BaseBean> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.addUserAppAgreementRecord(protocolsAgreeReq), action1, onError);
    }

    public Subscription getImgCode(ImgCodeRequest imgCodeRequest, Action1<ImgCodeRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getImgCode(imgCodeRequest), action1, onError);
    }

    //获取用户实名信息
    public Subscription getUserCom(CommonRequest commonRequest, Action1<UserInfoRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.getUser(commonRequest), action1, onError);
    }

    //校验桂花分账号是否存在
    public Subscription queryAccountExist(AccountExistReq accountExistReq, Action1<AccountExistRes> action1, Action1<Throwable> onError) {
        return doSubscription(mHttpApi.accountExist(accountExistReq), action1, onError);
    }

    public Subscription preAuthThird(PreAuthThiedReq preAuthThiedReq, Action1<PreAuthThirdRes> action1, Action1<Throwable> onError) {

        return doSubscription(mHttpApi.preAuthThird(preAuthThiedReq), action1, onError);
    }


}
